<?php slot('theme','now'); ?>
<div class="W100p mainptn">
	<div class="Cw1280">
        <!--成长烦恼-->
        <div class="Czfn_div" style="width:860px;">
            <div class="xzdiv">
                <div class="xzxxpto" style="margin:0px;"><img src="<?php echo $group_info->getThumbCover('groupcover'); ?>" width="60" height="60" /><!--图片--></div>
                <div class="xzdivri">
                    <div class="zxdivrit"><span><?php echo $group_info->getName(); ?></span>
                        <?php if($sf_user->isAuthenticated()): ?>
                        <a href="javascript:void(0);" id="attention" group_id="<?php echo $group_info->getId(); ?>" attenthon="<?php echo $group_info->hasUserById($sf_user->getAttribute('user_id')); ?>" >
                            <?php if($group_info->hasUserById($sf_user->getAttribute('user_id')) == 0): ?>
                            加入新小组
                            <?php else: ?>
                            退出小组
                            <?php endif; ?>
                        </a>
                        <?php else: ?>
                        <a href="javascript:void(0);"  onclick="alert('请先登入!');" >加入新小组</a>
                        <?php endif; ?>
                    </div>
                    <div class="zxdivrix">创建于<?php echo date('Y-m-d',strtotime($group_info->getCreatedAt())); ?>　　组长：<a href="javascript:void(0);"><?php echo $group_info->getAdmin(); ?></a></div>
                </div>
                <div class="zxsamll">
                    <?php echo $group_info->getRaw('descripts'); ?>
                </div>
            </div>
            
            
            
            <div class="zxhtitle">
                <?php if($sf_request->hasParameter('recommend') && $sf_request->getParameter('recommend',0) == 1): ?>
                <h4><a href="<?php echo url_for('theme/group?id='.$group_info->getId()); ?>" >最新话题</a>/</h4>
            	<h1><span>最热</span></h1>
                <?php else: ?>
                <h1><span>最新话题</span></h1>
                <h4>/<a href="<?php echo url_for('theme/group?id='.$group_info->getId().'&recommend=1'); ?>" >最热</a></h4>
                <?php endif; ?>
                <h3><a href="<?php echo url_for('theme/add?group_id='.$group_info->getId()); ?>">发布新主题</a></h3>
                <h2>总主题 <span><?php echo $group_info->getThemeNum(); ?></span></h2>
            </div>
            <?php foreach($pager->getResults() as $theme): ?>
            <div class="zxhtlist">
            	<div class="zxhtlistpto"><img src="<?php echo $theme->getUser()->getCover(); ?>" width="48" height="48"></div>
                <div class="zxhtlistc">
                	<div class="DetitleCt" style="padding-top:0px;">
                    	<a href="<?php echo url_for('theme/show?id='.$theme->getId()); ?>"><?php echo $theme->getTitle(); ?></a>
                        <div class="zxhtfrom" style="width:auto; float:right;">
                            <h2 style="margin-top:0px;"><span class="lk"><?php echo $theme->getAttr()->getReadNum(); ?></span><span class="ly"><?php echo $theme->getAttr()->getCommentNum(); ?></span></h2>
                        </div>
                    </div>
                    <div class="Deuntx"><strong><?php echo $theme->getUser()->getNickname(); ?></strong> | <span><?php echo $theme->getUser()->getCity(); ?> <?php echo $theme->getChildrenInfo(); ?>
</span></div>
                    <div class="zxhtlistcdiv" style="margin-bottom:15px;">
                        <?php if($theme->getHasCover()): ?>
                    	<img src="<?php echo $theme->getCover(); ?>" width="150" height="85">
                        <?php endif; ?>
                        <p>
                            <?php if(mb_strwidth(strip_tags($theme->getRaw('content')),'UTF8') > 80 && $theme->getHasCover() == 1): ?>
                            <?php echo mb_strimwidth(strip_tags($theme->getRaw('content')), 0, (3*70), '.........', 'UTF8'); ?>
                            <?php elseif(mb_strwidth(strip_tags($theme->getRaw('content')),'UTF8') > 105 && $theme->getHasCover() == 0) : ?>
                            <?php echo mb_strimwidth(strip_tags($theme->getRaw('content')), 0, (3*100), '.........', 'UTF8'); ?>
                            <?php else: ?>
                            <?php echo strip_tags($theme->getRaw('content')); ?>
                            <?php endif; ?>
                        </p>
                    </div>
                </div>
            </div>
            
       <?php endforeach; ?>
            <?php echo pager_navigation_theme($pager, 'theme/group?id='.$sf_request->getParameter('id'),4); ?>
        </div>
        
        <!--右边-->
        <div class="DeRight" style="width:360px;">
        	<div class="Detitle2" style="margin-top:0px;"><h1>加入该小组的成员</h1></div>
            <div class="xzcylist" id="attention_people">
               <?php foreach($group_info->getGroupUser() as $user): ?>
            	<li><a href="" title="<?php echo $user['name']; ?>"><img src="<?php echo $user['cover']; ?>" width="38" height="38"><br /><?php echo mb_strimwidth($user['name'], 0, (12),'', 'UTF8'); ?></a></li>
                <?php endforeach; ?>
            </div>
            <div class="xzcymore"><a href="" title="">> 查看所有 <span id="attention_people_num"><?php echo $group_info->getPeopleNum(); ?></span> 名成员</a></div>
            
        	<style>
			.xzxxti {border-bottom:1px solid #ccc; padding-bottom:20px;}
			</style>
        	<div class="Detitle2" style="margin-top:0px;"><h1>小组推荐</h1></div>
<?php if($sf_user->isAuthenticated()): ?>
        <?php include_component('theme', 'login_recommend_group'); ?>        
<?php else: ?>
       <?php include_component('theme', 'nologin_recommend_group'); ?>         
<?php endif; ?>
        	
            <div class="Detitle2"><h1>精彩评论</h1></div>
            <?php include_component('theme', 'recommend_comment'); ?>         
<!--            <div class="jcprdiv">
            	<div class="t">小呆瓜<span>2015-05-30 12:30</span></div>
                <div class="c">为了遮而遮住，为了掀而掀开，这是什么逻辑，用户得有多无聊？需求都讲不通，还一堆水军在这强词夺理。AppStore社交排行榜千名以外，应用宝下载量1万多，还每天自增长1200多，告诉你社交榜100名左右的，每天的自增长都不到500，吹牛也需要技术的，不然容易露底</div>
                <div class="p">评论于<a href="">遮图社交“遮遮”：暴露没什么了不起，遮住才是真诱惑</a></div>
            </div>
            <div class="jcprdiv">
            	<div class="t">小呆瓜<span>2015-05-30 12:30</span></div>
                <div class="c">为了遮而遮住，为了掀而掀开，这是什么逻辑，用户得有多无聊？需求都讲不通，还一堆水军在这强词夺理。AppStore社交排行榜千名以外，应用宝下载量1万多，还每天自增长1200多，告诉你社交榜100名左右的，每天的自增长都不到500，吹牛也需要技术的，不然容易露底</div>
                <div class="p">评论于<a href="">遮图社交“遮遮”：暴露没什么了不起，遮住才是真诱惑</a></div>
            </div>
            <div class="jcprdiv">
            	<div class="t">小呆瓜<span>2015-05-30 12:30</span></div>
                <div class="c">为了遮而遮住，为了掀而掀开，这是什么逻辑，用户得有多无聊？需求都讲不通，还一堆水军在这强词夺理。AppStore社交排行榜千名以外，应用宝下载量1万多，还每天自增长1200多，告诉你社交榜100名左右的，每天的自增长都不到500，吹牛也需要技术的，不然容易露底</div>
                <div class="p">评论于<a href="">遮图社交“遮遮”：暴露没什么了不起，遮住才是真诱惑</a></div>
            </div>-->
            
        </div>
        
    </div>
</div>
<script type="text/javascript">
<?php if($sf_user->hasFlash('error') ): ?>
layer.msg('<?php echo $sf_user->getFlash('error'); ?>');
<?php endif; ?>
<?php if($sf_user->hasFlash('success')): ?>
layer.msg('<?php echo $sf_user->getFlash('success'); ?>');
<?php endif; ?>
    
$(document).ready(function(){
    
    $("#attention").on('click',function(){
        var att_button = $(this);
        var w_id = $(this).attr('group_id');
        var is_attenthion = $(this).attr('attenthon');
        var url = '';
        var text = '',attenthon = 0;
        console.log(is_attenthion);
        if(is_attenthion == 0){
            url = "<?php echo url_for('theme/attention'); ?>";
            text = '退出小组';
            attenthon = 1;
        }else{
            url = "<?php echo url_for('theme/unattention'); ?>";
            text = '加入小组';
            attenthon = 0;
        }
        
        $.post(url,{"group_id":w_id},function(data){
            var msg = eval("("+data+")");
            
            if(msg.error == 0){
                att_button.text(text).attr('attenthon',attenthon);
                var num = msg.data.people_num;
                var people = msg.data.people;
                $("#attention_people_num").text(num);
                var html = '';
                
                for(var i in people){
                    html+='<li><a href="javascript:void(0);"><img src="'+people[i].cover+'" width="38" height="38"><br />'+people[i].name+'</a></li>';
                }
                
                $("#attention_people").html(html);
            }
            layer.msg(msg.msg);
        });
        
    });
    
});
</script>